Skip to content

Instantly share code, notes, and snippets.

Comment to https://www.reddit.com/r/ProgrammingLanguages/comments/1cphrxp/is_this_a_sane_set_of_tokens_for_my_lexer_a_few/

Also, do you guys have any resources on algorithms on ASTs, for type checking, maybe about linear typing and borrow checking as well? That's assuming the AST is the place where I'm supposed to check this sort of stuff.

There are a number of different approaches to typechecking, so there isn't a single answer or direction to go. For systems that support strong type inference, there are two well-known approaches: Hindley-Milner (HM) and bidirectional (bidir) systems, and these approaches aren't entirely separate (HM is often put in bidirectional checking to help with generics). There is also the simpler unidirectional approach taken by older languages e.g. Java, and the simpler way of handling generics by annotating every generic function and datastructure.

Giving direction on typechecking is unfortunately difficult because it is opinionated, because there is a line to straddle with wh

@pauloromeira
pauloromeira / tlp
Last active May 12, 2024 21:36
My TLP config file (/etc/default/tlp) for ThinkPad
# ------------------------------------------------------------------------------
# tlp - Parameters for power saving
# See full explanation: http://linrunner.de/en/tlp/docs/tlp-configuration.html
# dir: /etc/default/tlp
# Hint: some features are disabled by default, remove the leading # to enable
# them.
# Set to 0 to disable, 1 to enable TLP.
@wilr
wilr / admin.yml
Last active May 12, 2024 21:34
Big & Beautiful Silverstripe Elemental Previews
---
Name: "admin-custom"
---
SilverStripe\Admin\LeftAndMain:
extra_requirements_css:
- "app/client/element-preview.css"
@halicki
halicki / mc-wrapper.fish
Last active May 12, 2024 21:34
Midnight commander wrapper script for the fish shell
function mc
set SHELL_PID %self
set MC_PWD_FILE "/tmp/mc-$USER/mc.pwd.$SHELL_PID"
/usr/bin/mc -P $MC_PWD_FILE $argv
if test -r $MC_PWD_FILE
set MC_PWD (cat $MC_PWD_FILE)
if test -n "$MC_PWD"
@lukecyca
lukecyca / gist:9f88aad1b6473047ec7a0d5a8afd37fe
Created July 19, 2020 18:18
Capture data from MrCool Cielo mini split
import requests
import json
session = requests.Session()
def login(username, password):
# Initial request - get session id
r = session.get('https://smartcielo.com/')
//
// CloudCompositingView.swift
// OpenSwiftUIDesigns
//
// Created by Amos Gyamfi on 9.4.2024.
//
import SwiftUI
struct CloudCompositingView: View {
//
// DateTimeTimerView..swift
import SwiftUI
struct DateTimeTimerView: View {
var body: some View {
NavigationStack {
List {
// 1. Month, day, year
//
// MeasuringHeartRate.swift
import SwiftUI
struct MeasuringHeartRate: View {
@State var measuring = false
let streamBlue = Color(#colorLiteral(red: 0, green: 0.3725490196, blue: 1, alpha: 1))
let streamRed = Color(#colorLiteral(red: 1, green: 0, blue: 0, alpha: 1))
//
// SignatureAnimation.swift
// OpenSwiftUIAnimations
//
// Created by Amos Gyamfi on 11.5.2024.
//
import SwiftUI
struct SignatureAnimation: View {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Custom Scrollbar</title>
<style>
.scroll-box {
position: relative;
width: 300px; /* Adjust to fit your design */